<template>
  <div>
     <h3>陈帅鹏黑店</h3>
     <HmSon 
     v-for='item in list'
     :key='item.id' 
     :id='item.id'
      :proname='item.proname'
      :proprice='item.proprice'
      :desc='item.desc'
      @NewPrice='newprice'
     ></HmSon>
   </div>
</template>
 
<script>
// 引入
import HmSon from './hmd-son.vue'
export default {
  //注册
  components:{
    HmSon,
  },
 name:'HmFather',
 data() {
    return {
      list: [
        {id: 1,proname: '超级好吃的棒棒糖',proprice: 188,low: 160,desc:'甜'},
        {id: 2, proname: '超级好吃的大鸡腿',proprice: 360,low: 320,desc:'香'},
        {id: 3, proname: '超级无敌的冰激凌', proprice: 42, low: 30, desc:'冰'},
      ],
    }
  },
  methods:{
    newprice(id){
      this.list.forEach(item=>{
        if(item.id === id){
          item.proprice>item.low?item.proprice-=10:alert('成本价了')
        }
      })
    }
  }
};
</script>

<style scoped>
     
</style>